<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Home extends CI_Controller {

	function __construct(){
		parent::__construct();
		$this->load->library('auth');
	}
	public function index()
	{
		if($this->auth->is_logged_in() == true)
		{
			// get level untuk user ini
			$level = $this->session->userdata('LEVEL_GROUP');

			// ambil menu dari database sesuai dengan level	
			$dataMenu= $this->auth->get_menu($level);

			//ubah data menjadi JSON
			$data["menu_json"]= json_encode($dataMenu);
			$data['view_menu']='layouts/menu_view';
			$data['view_main']='main_view';
			$data['layout_title']='Property Management';
			
			$this->load->view('layouts/home_view',$data);
		}else{
		
			// jika belum login maka larikan ke halaman login
			redirect('login');
		
		}
	}
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */